﻿using M.ShopMachine.Repository.Interface;
using M.ShopMachine.Write.WebApi.Application.Command.MaintainCommand;
using MediatR;

namespace M.ShopMachine.Write.WebApi.Application.Handler.MaintainHandler
{
    public class AddMaintainHandler : IRequestHandler<AddMaintainCommand, int>
    {
        private readonly IMaintainRepository maintainRepository;

        public AddMaintainHandler(IMaintainRepository maintainRepository)
        {
            this.maintainRepository = maintainRepository;
        }

        public async Task<int> Handle(AddMaintainCommand request, CancellationToken cancellationToken)
        {
            return await maintainRepository.AddMaintainAsync(request);
        }
    }
}
